Enum<cardvalue>;
cardvalue={PA,P2,P3,P4,P5,P6,P7,P8,P9,P10,PJ,PQ,PK};
Enum<color>;
color={Spade,Club,Heart,Diamond};
Enum<card>=<number,color>;
Enum<player>;
player={dealer, player1, player2, player3};
Enum<player> winner;
Container<card> common_deck;
Container<card> hand_cards[player];

main()
{
			
}

event start()
{
	Enum<cardvalue> newvalue=PA;
	Enum<color> newcolor=Spade;
	Enum<player> currentplayer=player1;
	do {
		do {
			common_deck.add(<newvalue,newcolor>);
			newcolor++;
		} while(newcolor!=Spade)
		newcard++;
	} while(newcard!=PA)
	common_deck.shuffle();
	
	do {
		hand_cards[currentplayer].add(common_deck.pop());
		hand_cards[currentplayer].add(common_deck.pop());
		currentplayer++;
	} while(currentplayer!=player3)
	playround();				
}

event playround()
{
	Enum<player> currentplayer=player1;
	int sum;
	
	do{
		sum=0;
		for (int i = 0; i < hand_cards.size(); i++)
		{
			sum = sum+hand_cards[currentplayer].index(i).value;		
		}
		currentplayer++;
	} while (currentplayer != player1)

	if ( (sum > 21) || (common_deck.size() == 0)) {
		gameover();
	}

	do{
		for (int i = 0; i < hand_cards.size(); i++)
		{
			if (getinput from currentplayer == YES)
				hand_cards[currentplayer].add(common_deck.pop());
		}
		currentplayer++;
	} while (currentplayer != player1)
		
			
	playround();		
}

event gameover()
{
	output(winner wins);		
}
